/*********************************************************************
* File: World.h
*
* The World.
*********************************************************************/
#pragma once

#include "../engine.h"
#include "IWorld.h"
namespace agents{ class Agent; }

namespace game{ 
	/**
	* \brief The World.
	* 
	* Manages world information.
	*
	* \author Instituto Superior Tecnico de Lisboa, Portugal
	* \author Technical University of Lisbon, Portugal
	* 
	* \author Agentes Autonomos e Sistemas Multiagente
	* \author Autonomous Agents and Multiagent Systems
	* 
	* \version	1.0
	* \date		2006/2007
	**/
	class World: public IWorld{
	public:
		World();
		~World();

		void newRound();

		/** 
		* \brief Gets the absolute time.
		*
		* \see game::IWorld::getTime
		**/
		float getTime(){ return gpGlobals->time; }
		/** 
		* \brief Gets the maximum number of players.
		*
		* \see game::IWorld::getMaxPlayers
		**/
		int getMaxPlayers(){ return gpGlobals->maxClients; }

		/** 
		* \brief Gets the time the bomb was planted.
		*
		* \see game::IWorld::getTimeBombWasPlanted
		**/
		float getTimeBombWasPlanted(){ return _timeBombWasPlanted; }
		/** 
		* \brief Sets the time the bomb was planted.
		**/
		void setTimeBombWasPlanted(float value){ _timeBombWasPlanted = value; }
		/** 
		* \brief Whether the bomb was planted.
		*
		* \see game::IWorld::isBombPlanted
		**/
		bool isBombPlanted(){ return _isBombPlanted; }
		/** 
		* \brief Sets whether the bomb as planted.
		*
		* \see game::IWorld::setIsBombPlanted
		**/
		void setIsBombPlanted(bool value){ _isBombPlanted = value; }
		/** 
		* \brief Gets the time the round started.
		*
		* \see game::IWorld::getTimeRoundStarted
		**/
		float getTimeRoundStarted(){ return _timeRoundStarted; }
		float getTimeRoundEnds();
		/** 
		* \brief Whether the round is over.
		*
		* \see game::IWorld::isRoundOver
		**/
		bool isRoundOver(){ return _isRoundOver; }
		/** 
		* \brief Sets whether the round is over.
		**/
		void setIsRoundOver(bool value){ _isRoundOver = value; }
		/** 
		* \brief Whether the map has been initialized.
		**/
		bool isMapInitialized(){ return _isMapInitialized; }
		/** 
		* \brief Sets whether the map has been initialized.
		**/
		void setIsMapInitialized(bool value){ _isMapInitialized = value; }
		MapTypes::Enumeration getMapType();
		void getMapName(char buffer[MAP_NAME_MAX_SIZE]);
		Vector getBombPosition(bool armed=true);

		/**
		* \brief Agents in the game. 
		* 
		* Maximum number of agents is 32.
		**/
		agents::Agent* agents[32];
		/** 
		* \brief The hosting entity. 
		**/
		edict_t *hostEdict; 
		/** 
		* \brief The map type.
		**/
		int mapType;
		/** 
		* \brief Whether it is CS version 1.6.
		**/
		bool isVersion16;

	private: 
		/** 
		* \brief Time bomb was planted.
		**/
		float _timeBombWasPlanted;
		/** 
		* \brief Whether the bomb was planted.
		**/
		bool _isBombPlanted;
		/** 
		* \brief Round start time. 
		**/
		float _timeRoundStarted;
		/** 
		* \brief Whether the round is over.
		**/
		bool _isRoundOver;
		/** 
		* \brief Whether the map has been initialized.
		**/
		bool _isMapInitialized;
	};
}

